<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>商之联-商家后台管理系统</title>
  <meta name="description" content="这是一个 table 页面">
  <meta name="keywords" content="table">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="icon" type="image/png" href="{:C('SHOP_HOME_IMG')}favicon.png"> <link rel="apple-touch-icon-precomposed" href="{:C('SHOP_HOME_IMG')}app-icon72x72@2x.png">
  <meta name="apple-mobile-web-app-title" content="Amaze UI" />
  <link rel="stylesheet" href="{:C('SHOP_HOME_CSS')}amazeui.min.css"/>
  <link rel="stylesheet" href="{:C('SHOP_HOME_CSS')}admin.css">
</head>
<body>
<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
  以获得更好的体验！</p>
<![endif]-->
<!-- header start-->

<include file="Public:header"/>

<!-- header end-->

<div class="am-cf admin-main">
 <!-- sidebar start -->
   <include file="Public:menu"/>
  <!-- sidebar end -->
  
  <!-- content start -->
  <div class="admin-content">
  <!-- 基本信息 start-->
  <div class="am-cf am-padding">
      <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">订单列表</strong> / <small>订单详情</small></div>
    </div>
    <!--基本信息start -->
    <div class="am-g">
      <section class="am-panel am-panel-default">
        <header class="am-panel-hd">
          <h3 class="am-panel-title">基本信息</h3>
        </header>
        <div class="am-panel-bd">
                  <table class="am-table am-table-bd am-table-striped admin-content-table">
                    <tbody>
                    <tr> <td align="right">收货人：</td><td>{$order['consignee']}</td>
                    <td align="right">联系方式:</td><td>{$order['mobile']} </td>
                    </tr>
                    <tr>
                    <td align="right">收货地址:</td><td>{$order['province']}{$order['city']}{$order['district']}{$order['address']}</td>
                    </tr>
                    <tr>
                    <td align="right">经销商信息:</td> <td>{$shopinfo['companyname']}</td>
                    <td align="right">地址:</td> <td>{$shopinfo['address']}</td>
                    </tr>
                    <tr>
                      <td align="right">电话:</td><td>{$shopinfo['mobile']}</td>
                      <td align="right">座机:</td><td>{$shopinfo['telephone']}
                      </td>
                    </tr>
                    <!--  <tr>
                                        <td align="right">供应商信息:</td> <td>{$supperinfo['companyname']}&nbsp &nbsp &nbsp {$supperinfo['contactname']} &nbsp &nbsp &nbsp {$supperinof['mobile']} </td>
                                       
                                        </tr> -->
                    
                    </tbody>
                  </table>
         
        </div>
    </section>
    </div>
    <!--基本信息end -->
    <!--s商品start -->
     <div class="am-g">
      <section class="am-panel am-panel-default">
        <header class="am-panel-hd">
          <h3 class="am-panel-title">商品信息</h3>
        </header>
        <div class="am-panel-bd">
                  <table class="am-table am-table-bd am-table-striped admin-content-table">
                    <thead>
                      <td>订单编号</td>
                      <td>商品</td>
                      <td>属性</td>
                      <td>单价</td>
                      <td>供货价</td>
                      <td>毛利额</td>
                      <td>毛利率(%)</td>
                      <td>数量</td>
                      <!-- <td>供应商</td> -->
                      <td>商品总价</td>
                    </thead>
                    <tbody>
                    <td>{$order['order_sn']}</td>
                    <td>{$order['itemname']}</td>
                    <td>{$order['specvale']}</td>
                    <td>{$order['price']}</td>
                    <td>{$order['supperprice']}</td>
                     <td>
                    <?php if(!$profit){
                     echo "暂无" ;
                      }else{
                        echo $profit;
                        };?></td>
                    <td> <?php if(!$rate){
                     echo "暂无" ;
                      }else{
                        echo $rate;
                        };?></td>
                    <td>{$order['number']}</td>
                   <!--  <td>测试供应商</td> -->
                    <td>{$order['order_amount']}</td>
                    </tbody>
                  </table>        
        </div>
    </section>
    </div>
    <!--商品信息end-->
    <!-- 订单状态-->
     <div class="am-g">
      <div class="am-g">
         <div class="am-u-sm-12">
          <table class="am-table am-table-bordered am-table-striped am-table-compact orderlog">
                <thead>
                  <tr>
                      <th>操作者</th>
                      <th>操作时间</th>
                      <th>订单状态</th>
                      <th>付款状态</th>
                      <th>发货状态</th>
                      <th>备注</th>
                  </tr>
            </thead>
            <tbody></tbody>
                  
          </table>
         </div>
      </div>

    <if condition="$orderstatus eq  0 OR $orderstatus eq 1 ">
    <button type="button" class="am-btn confirmorder " style="margin-right:10px"  data-am-modal="{target: '#my-alert'}" >确认订单</button>
    <button type="button" class="am-btn pay_button " style="margin-right:10px"  data-am-modal="{target: '#my-alert'}" >支付订单</button>
    </if>
    <if condition="$orderstatus eq  8 ">
      <button type="button" class="am-btn  confirmreceipt " style="margin-right:10px"  data-am-modal="{target: '#my-alert'}" >确认收货</button>
    </if>
    <if condition="$orderstatus lt 1 OR $orderstatus eq 1 ">
    <button type="button" class="am-btn  cannelorder">取消订单</button>
    </if>
    </div>
    <!--订单状态 -->
    <br/>
  <div class="am-modal-dialog selpay" style="display:none">
   <div class="am-modal-hd">选择支付方式</div>
   <form>
    <span style="display:block; margin-left:10px"><input type="radio" name="paytype"> <button type="button" class="am-btn am-btn-danger">余额支付</button></span><br/>
    <span style="display:block;margin-left:10px"><input type="radio" name="paytype"> <button type="button" class="am-btn am-btn-danger">支付宝支付</button></span><br/>
    <button type="submit" class="am-btn ">确定</button>
    <input type="hidden" value={$order['orderid']} class="orderid" name="orderid" />
    <input type="hidden" value={$order['order_amount']} class="amount" />
    <input name="orderstatus" value="{$orderstatus}" class="orderstatus" type="hidden">
    </form>   
  </div>







    </div>

  <!-- content end -->

  <!--footer start-->
  <footer>
  <hr>
  <p class="am-padding-left">© 2014 商之联.</p>
</footer>
<!-- footer end -->
<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="{:C('SUPPLIER_ADMIN_JS')}polyfill/rem.min.js"></script>
<script src="{:C('SUPPLIER_ADMIN_JS')}polyfill/respond.min.js"></script>
<script src="{:C('SUPPLIER_ADMIN_JS')}amazeui.legacy.js"></script>
<![endif]-->

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="{:C('SHOP_HOME_JS')}jquery.min.js"></script>
<script src="{:C('SHOP_HOME_JS')}amazeui.min.js"></script>
<!--<![endif]-->
<script src="{:C('SHOP_HOME_JS')}app.js"></script>
 <script src="{:C('SHOP_HOME_JS')}shop.js"></script>
<script type="text/javascript">
  $('.pay_button').click(function(){
      var orderstatus=$('.orderstatus').val();
      if(orderstatus==false){alert('请先确认订单！');return false;}
      $('.selpay').toggle();
  });
//取消订单
 $(document).on('click','.cannelorder',function(){
    var  orderid=$("input[name='orderid']").val();
    $.Order.cannelorder(orderid);
  })
//订单操作
 $(function(){
  var $orderid=$("input[name='orderid']").val();
  $.ajax({
    type:"POST",
    url:"/shop.php/Home/Order/orderAction",
    data:{"orderid":$orderid},
    dataType:"json",
    success:function(message){
      if (message.status) 
      {
       var $logs=message.logs;
       var  $tbody=$('<tbody></tbody>');
       var $string='';
       $.each($logs,function(key,log){
        $string+="<tr>";
        $string+="<td>"+log.action_user+"</td>";
        $string+="<td>"+log.edittime+"</td>";
        var $status=parseInt(log.status);
        switch($status)
        {
          case 0:
          $string+="<td>未确认</td>";
          $string+="<td>未付款</td>";
          $string+="<td>未发货</td>";
          $string+="<td>"+log.action_note+"</td>";
          break;
          case 2:
          $string+="<td>未确认</td>";
          $string+="<td>未付款</td>";
          $string+="<td>未发货</td>";
          $string+="<td>订单已取消</td>";
          break;
          case 1:
          $string+="<td>已确认</td>";
          $string+="<td>未付款</td>";
          $string+="<td>未发货</td>";
          $string+="<td>"+log.action_note+"</td>";
          break;
          case 3:
          $string+="<td>已确认</td>";
          $string+="<td>已付款</td>";
          $string+="<td>未发货</td>";
          $string+="<td>"+log.action_note+"</td>";
          break;
          case 6:
          $string+="<td>已确认</td>";
          $string+="<td>已付款</td>";
          $string+="<td>配货中</td>";
          $string+="<td>"+log.action_note+"</td>";
          break;
          case 8:
          $string+="<td>已确认</td>";
          $string+="<td>已付款</td>";
          $string+="<td>已发货</td>";
          $string+="<td>"+log.action_note+"</td>";
          break;
          case 9:
          $string+="<td>已确认</td>";
          $string+="<td>已付款</td>";
          $string+="<td>已收货</td>";
          $string+="<td>"+log.action_note+"</td>";
          break;
        } 
        $string+="</tr>"; 
      });
       $tbody.append($string);
       $($tbody).replaceAll(".orderlog tbody");

     }else{
      return '';
    }
  }
})
})
</script>
</body>
</html>